/***************************************************************************
			   HTMLwriter.cpp  -  description
			      -------------------
     begin                : Aug 29 2001
     copyright            : (C) 2001 by Gianluca Masone
     email                : lucas75it@yahoo.it
***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

// ---------------------------------------------------------------------------
//  Includes
// ---------------------------------------------------------------------------
#include "htmlWriter/HTMLwriter.h"

// ---------------------------------------------------------------------------
//  Members
// ---------------------------------------------------------------------------

//! Write the head of the html page
void 
HTMLwriter::writeHead(void) { 

  // Begin <html> TAG 
  htmlpage << "<html>\n";

  // Begin <head> TAG
  htmlpage << "<head>\n"
	   << "<meta http-equiv=\"Content-Type\" " 
	   << "content=\"text/html; charset=windows-1252\">\n"
	   << "<meta name=\"GENERATOR\" content=\"emacs-20.7\">\n"
	   << "<title>XOgastan REPORTS: " << pageTitle << " </title>\n"
	   << "<link href=\"style.css\" rel=\"stylesheet\" type=\"text/css\">\n";
  
  // End <head> TAG
  htmlpage << "</head>\n\n";
    
  // Begin <body> TAG
  htmlpage << "<body bgcolor=\"white\">\n\n";
  
  // Comment
  htmlpage << "<!-- Generated by XOgastan -->\n\n";

  // Introduction information 
  htmlpage << "<table border=\"0\" width=\"100%\">\n\n";
  htmlpage << "\t<td width=\"35%\">"
	   << "<img border=\"0\" src=\"xogastan_logo.jpg\">"
	   << "</td>\n\n";
  htmlpage << "\t<td width=\"65%\">"
	   << "<p><left>"
	   << "<h1>" << pageTitle << "</h1></left></p></td>\n\n";
  htmlpage << "</table>\n\n";

  // Xogastan report info
  htmlpage << "<br>\n";
  htmlpage << "<table border=\"0\" width=\"800\">\n\n";
  htmlpage << "\t<td width=\"100%\" bgcolor=\"#000000\" bordercolor=\"#FFFFFF\">\n"
	   << "\t<p align=\"center\">\n"
	   << "\t<small>\n"
	   << "\t<font color=\"#FFFFFF\">\n"
	   << "\tThis report file has been generated by XOgastan\n"
	   << "\t</font>\n"
	   << "\t</small>\n" 
	   << "\t</p>\n"
	   << "\t</td>\n\n";
  htmlpage << "</table>\n\n";

}

//! Write the horizontal index
void 
HTMLwriter::writeIndex(void) {
  
  // Comment
  htmlpage << "<!-- Index of the files -->\n\n";

  htmlpage << "\n<table border=\"0\" width=\"800\">\n";

  htmlpage << "\t<td width=\"25%\" bgcolor=\"#DFAFEA\" height=\"28\">"
	   << "<div align=\"center\">"
	   << "<a href=\"" << HTMLfilesRegister::homePage << "\">Home</a>"
	   << "</div>\n"
	   << "\t</td>\n";

  htmlpage << "\t<td width=\"25%\" bgcolor=\"#30E5AF\" height=\"28\">"
	   << "<div align=\"center\">"
	   << "<a href=\"" << HTMLfilesRegister::fnctIndex << "\">Functions</a>"
	   << "</div>\n"
	   << "\t</td>\n";

  htmlpage << "\t<td width=\"25%\" bgcolor=\"#F5F96D\" height=\"28\">"
	   << "<div align=\"center\">"
	   << "<a href=\"";
  if (!noNastStat) 
    htmlpage << HTMLfilesRegister::nastStatistics;
  htmlpage << "\">";
  if (!noNastStat) 
    htmlpage << "NAST statistics";
  htmlpage << "</a></div>\n"
	   << "\t</td>\n";

  htmlpage << "\t<td width=\"25%\" bgcolor=\"#FF9D00\" height=\"28\">"
	   << "<div align=\"center\">"
	   << "<a href=\"\"></a>"
	   << "</div>\n"
	   << "\t</td>\n\n";

  htmlpage << "</table>\n\n";

}


//! Write section title bar
void 
HTMLwriter::writeSectionTitle(string sectionTitle) 
{
  // Comment
  htmlpage << "<!-- Section Title -->\n\n";

  // bar
  htmlpage << "<table border=\"0\" width=\"100%\">"
	   << "<td  bgcolor=\"#EFDEBF\" width=\"100%\">"
	   << "<b>" << sectionTitle << "</b>"
	   << "</td>"
	   << "</table>\n";

  return;
}

//! Write the foot of the html page
void 
HTMLwriter::writeFoot(void) { 

  // Comment
  htmlpage << "<!-- Foot -->\n\n";

  // Final bar info
  htmlpage << "<table border=\"0\" width=\"800\">\n\n";
  htmlpage << "\t<td width=\"100%\" bgcolor=\"#000000\" bordercolor=\"#FFFFFF\">\n"
	   << "\t<p align=\"center\">\n"
	   << "\t<small>\n"
	   << "\t<font color=\"#FFFFFF\">\n"
	   << "\tXOgastan : Xml Oriented Gnu AST ANalyzer\n"
	   << "\t</font>\n"
	   << "\t</small>\n" 
	   << "\t</p>\n"
	   << "\t</td>\n\n";
  htmlpage << "\t</tr>\n\n";
  htmlpage << "\t<td width=\"100%\">\n"
	   << "\t<p align=\"center\">\n"
	   << "\t<img border=\"0\" src=\"xogastan_logo_small.jpg\">\n"
	   << "\t</p>\n"
	   << "\t</td>\n";
  htmlpage << "\t</table>\n\n";

    

  // End <body> TAG
  htmlpage << "</body>\n";
  
  // End <html> TAG
  htmlpage << "</html>";

}


  





